/** init domain config */
import Vue from 'vue'
//设置全局API_BASE_URL
Vue.prototype.API_BASE_URL = process.env.VUE_APP_API_BASE_URL
const base_url = {
    'ztsj.crec.cn': 'https://ztsj.crec.cn/ztsjxxxt',
    '10.81.15.20': 'https://10.81.15.20/ztsjxxxt',
    '223.71.67.171': 'https://223.71.67.171/ztsjxxxt',
    'shenji.inner.info-itic.cn': 'http://shenji.inner.info-itic.cn/ztsjxxxt',
    '192.168.96.36': 'http://192.168.96.36/ztsjxxxt',
    '10.76.2.175': '/api',
    'localhost': '/api',
    'audit.smartcrec.com': 'https://audit.smartcrec.com/api',
    'ztsj.smartcrec.com': 'https://ztsj.smartcrec.com/api',

}

// https://223.71.67.171:8012/onlinePreview
const onlinePreviewDomainURL = {
    'ztsj.crec.cn': 'https://ztsj.crec.cn/preview/onlinePreview',
    '10.81.15.20': 'https://10.81.15.25:8012/preview/onlinePreview',
    '223.71.67.171': 'https://223.71.67.171:8012/preview/onlinePreview',
    'shenji.inner.info-itic.cn': 'http://shenji.inner.info-itic.cn:8012/preview/onlinePreview',
    '192.168.96.36': 'http://192.168.96.36:8012/preview/onlinePreview',
    '10.76.2.175': 'https://audit.smartcrec.com/preview/onlinePreview',
    'localhost': 'http://127.0.0.1:8012/onlinePreview',
    'audit.smartcrec.com': 'https://audit.smartcrec.com/preview/onlinePreview',
    'ztsj.smartcrec.com': 'https://ztsj.smartcrec.com/preview/onlinePreview',
}
const onlinePreviewFileURL = {
    'shenji.inner.info-itic.cn': "http://node0.main.shenji.frontend.stage.extra",
    '10.76.2.175': '/api',
    'localhost': 'http://localhost:8084/ztsjxxxt',
    'audit.smartcrec.com': 'https://audit.smartcrec.com/api',
    'ztsj.smartcrec.com': 'https://ztsj.smartcrec.com/api',


}
let hostStr = window.location.host
let ip = hostStr.split(':')[0]
if (process.env.NODE_ENV === 'production') {
    console.log('生产模式');
    window._CONFIG['domianURL'] = base_url[ip]
    window._CONFIG['onlinePreviewFileURL'] = onlinePreviewFileURL[ip]
    window._CONFIG['onlinePreviewDomainURL'] = onlinePreviewDomainURL[ip]
} else {
    console.log('开发模式');
    window._CONFIG['domianURL'] = Vue.prototype.API_BASE_URL
    window._CONFIG['onlinePreviewFileURL'] = onlinePreviewFileURL[ip]
    window._CONFIG['onlinePreviewDomainURL'] = onlinePreviewDomainURL[ip]
}

//单点登录地址
window._CONFIG['casPrefixUrl'] = process.env.VUE_APP_CAS_BASE_URL
// window._CONFIG['onlinePreviewDomainURL'] = process.env.VUE_APP_ONLINE_BASE_URL
window._CONFIG['staticDomainURL'] = Vue.prototype.API_BASE_URL + '/sys/common/static'
window._CONFIG['pdfDomainURL'] = Vue.prototype.API_BASE_URL + '/sys/common/pdf/pdfPreviewIframe'

// 一体化登录地址
window._CONFIG['oauth2PrefixUrl'] = process.env.VUE_APP_OAUTH2_BASE_URL + '/idp/oauth2/authorize'
// 一体化登出
window._CONFIG['oauth2OutPrefixUrl'] = process.env.VUE_APP_OAUTH2_BASE_URL + '/idp/profile/OAUTH2/Redirect/GLO'